All three compilers (L1A, L1B, L2) PASS for fconst_0#553
Open
opencode-agent[bot] wants to merge 1 commit into
Open
All three compilers (L1A, L1B, L2) PASS for fconst_0#553opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
Co-authored-by: LSantha <LSantha@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec compliance report
Details
l1a Implementation
core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java:1792,core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java:74,core/src/core/org/jnode/vm/x86/compiler/l1a/FloatItem.java:88-110Analysis:
The L1A implementation correctly handles
fconst_0(opcode 0xb) by creating aFloatItemwithKind.CONSTANTand the value0.0f. TheFloatItemclass stores the float value and when loaded to a register or pushed to the stack, it usesFloat.floatToIntBits(value)(line 89, 109 in FloatItem.java) which correctly preserves the IEEE 754 bit pattern including signed zero (+0.0). The virtual stack mechanism delays emission until needed, maintaining the correct category-1 (single-slot) stack effect as required by the spec.l1b Implementation
core/src/core/org/jnode/vm/x86/compiler/l1b/X86BytecodeVisitor.java:2153,core/src/core/org/jnode/vm/x86/compiler/l1b/ItemFactory.java:67,core/src/core/org/jnode/vm/x86/compiler/l1b/FloatItem.java:88-110Analysis:
The L1B implementation is functionally identical to L1A for
fconst_0, with the addition of a bytecode counter increment. It creates aFloatItemwithKind.CONSTANTand value0.0f, using the sameFloat.floatToIntBits()conversion for register loads and stack pushes. The virtual stack and item management are equivalent to L1A, correctly preserving the float bit pattern and category-1 stack effect.l2 Implementation
core/src/core/org/jnode/vm/compiler/ir/IRGenerator.java:291,core/src/core/org/jnode/vm/compiler/ir/FloatConstant.java:38,core/src/core/org/jnode/vm/x86/compiler/l2/FPX86CodeGenerator.java:191Analysis:
The L2 compiler's
IRGenerator.visit_fconst()creates aFloatConstantIR node with the value0.0f. TheFloatConstant.getIntBits()method usesFloat.floatToRawIntBits(value)(line 39) which preserves the exact IEEE 754 bit representation including signed zero. During code generation,FPX86CodeGenerator.loadToFPUStack32()(line 191) handles the CONSTANT addressing mode by pushing the raw int bits to the stack and executingFLD32, correctly loading +0.0 onto the FPU stack. The IR assigns it to a single stack slot (stackOffset += 1), matching the category-1 requirement.JVM Spec References
fconst_0(opcode 0xb / 11)... → ..., 0.0float(category 1, single slot)All three JNode compiler tiers correctly implement the
fconst_0instruction per the JVM SE 6 specification.Closes #268
opencode session | github run